using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;

namespace WebApplication1.Controllers;

[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
    

    private readonly ILogger<WeatherForecastController> _logger;

    private ITest<TbTest> _test;

    private IOptions<TestOptions> _options;

    public WeatherForecastController(
        ILogger<WeatherForecastController> logger, 
        ITest<TbTest> _test,
        IOptions<TestOptions> _options
        )
    {
        _logger = logger;
        this._test = _test;
        this._options = _options;
    }

    [HttpGet(Name = "GetWeatherForecast")]
    public async Task<TestJson> Get()
    {
       var tb= _test.GetInstance(new TbTest(){Name = "test_name"});
      _logger.LogInformation(tb.Name  + _options.Value.Name);

      TestJson json = new TestJson();
      json.ConnectionString.Add("default","connection");
      json.ConnectionString.Add("default2","connection");
    
      
      return  await  Task.FromResult(json);
    }
}